import random

def generate_test_cases():
    # 生成1到9的随机测试用例
    test_cases = []
    for _ in range(5):  # 生成5个测试用例
        n = random.randint(1, 9)
        test_cases.append(n)
    return test_cases

def save_test_cases(test_cases):
    with open('test_cases.txt', 'w') as f:
        for n in test_cases:
            f.write(f"{n}\n")

if __name__ == "__main__":
    test_cases = generate_test_cases()
    save_test_cases(test_cases)
    print("测试用例已生成并保存到 test_cases.txt") 